/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrameDaftarObatAdmin.java
 *
 * Created on 04 Des 13, 0:33:03
 */
package frame;

import controller.AdminKontrol;
import controller.DokterKontrol;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import model.Dosis;
import model.EfekSamping;
import model.Indikasi;
import model.Kemasan;
import model.Komposisi;
import model.KontraIndikasi;
import model.Obat;
import model.Perhatian;
import tabelmodel.DosisTableModel;
import tabelmodel.DosisTerpilihTableModel;
import tabelmodel.EfekSampingTerpilihTableModel;
import tabelmodel.IndikasiTerpilihTableModel;
import tabelmodel.KemasanTerpilihTableModel;
import tabelmodel.KomposisiTerpilihTableModel;
import tabelmodel.KontraIndikasiTableModelTerpilih;
import tabelmodel.ObatTableModel;
import tabelmodel.PerhatianTableModelTerpilih;

/**
 *
 * @author Asus
 */
public class FrameDaftarObatDokter extends javax.swing.JFrame {

    /** Creates new form FrameDaftarObatAdmin */
    public FrameDaftarObatDokter() {
        initComponents();
        tampilObat();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        frameCariKategori = new javax.swing.JInternalFrame();
        lblCariKategori = new javax.swing.JLabel();
        txtCariKategori = new javax.swing.JTextField();
        lblJudulKategori = new javax.swing.JLabel();
        btnCariKategori = new javax.swing.JButton();
        btnBatalKategori = new javax.swing.JButton();
        frameCariKodeNama = new javax.swing.JInternalFrame();
        jLabel4 = new javax.swing.JLabel();
        lblDokterKode = new javax.swing.JLabel();
        lblDokterNama = new javax.swing.JLabel();
        txtKodeDokter = new javax.swing.JTextField();
        txtNamaDokter = new javax.swing.JTextField();
        btnCariKodeNama = new javax.swing.JButton();
        btnBatalKodeNama = new javax.swing.JButton();
        framePilihCari = new javax.swing.JInternalFrame();
        lblPilihCari = new javax.swing.JLabel();
        btnBatal = new javax.swing.JButton();
        btnKodeNama = new javax.swing.JButton();
        btnKategori = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabelObatDokter = new javax.swing.JTable();
        btnDetailADMIN = new javax.swing.JButton();
        btnCariDokter = new javax.swing.JButton();
        btnBatalDokter = new javax.swing.JButton();
        detail = new javax.swing.JInternalFrame();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtkodeobat = new javax.swing.JTextField();
        txtnamaobat = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        txtkategori = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        komposisi = new javax.swing.JTable();
        jScrollPane3 = new javax.swing.JScrollPane();
        indikasi = new javax.swing.JTable();
        jScrollPane4 = new javax.swing.JScrollPane();
        kontraindikasi = new javax.swing.JTable();
        jScrollPane5 = new javax.swing.JScrollPane();
        perhatian = new javax.swing.JTable();
        jScrollPane6 = new javax.swing.JScrollPane();
        dosis = new javax.swing.JTable();
        jScrollPane7 = new javax.swing.JScrollPane();
        kemasan = new javax.swing.JTable();
        jScrollPane8 = new javax.swing.JScrollPane();
        efeksamping = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        frameCariKategori.setClosable(true);

        lblCariKategori.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblCariKategori.setText("Kateogir Penyakit");

        lblJudulKategori.setFont(new java.awt.Font("Tahoma", 1, 24));
        lblJudulKategori.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblJudulKategori.setText("PENCARIAN BERDASARKAN KATEGORI PENYAKIT");

        btnCariKategori.setFont(new java.awt.Font("Tahoma", 0, 12));
        btnCariKategori.setText("Cari");
        btnCariKategori.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCariKategoriActionPerformed(evt);
            }
        });

        btnBatalKategori.setFont(new java.awt.Font("Tahoma", 0, 12));
        btnBatalKategori.setText("Batal");
        btnBatalKategori.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBatalKategoriActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout frameCariKategoriLayout = new javax.swing.GroupLayout(frameCariKategori.getContentPane());
        frameCariKategori.getContentPane().setLayout(frameCariKategoriLayout);
        frameCariKategoriLayout.setHorizontalGroup(
            frameCariKategoriLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameCariKategoriLayout.createSequentialGroup()
                .addGroup(frameCariKategoriLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(frameCariKategoriLayout.createSequentialGroup()
                        .addGap(143, 143, 143)
                        .addComponent(lblCariKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtCariKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(frameCariKategoriLayout.createSequentialGroup()
                        .addGap(209, 209, 209)
                        .addComponent(btnCariKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(32, 32, 32)
                        .addComponent(btnBatalKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(171, Short.MAX_VALUE))
            .addGroup(frameCariKategoriLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(frameCariKategoriLayout.createSequentialGroup()
                    .addGap(42, 42, 42)
                    .addComponent(lblJudulKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 622, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(51, Short.MAX_VALUE)))
        );
        frameCariKategoriLayout.setVerticalGroup(
            frameCariKategoriLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameCariKategoriLayout.createSequentialGroup()
                .addGap(128, 128, 128)
                .addGroup(frameCariKategoriLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCariKategori, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCariKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 69, Short.MAX_VALUE)
                .addGroup(frameCariKategoriLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCariKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnBatalKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(35, 35, 35))
            .addGroup(frameCariKategoriLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(frameCariKategoriLayout.createSequentialGroup()
                    .addGap(35, 35, 35)
                    .addComponent(lblJudulKategori)
                    .addContainerGap(247, Short.MAX_VALUE)))
        );

        frameCariKategori.setBounds(100, 20, 720, 340);
        jDesktopPane1.add(frameCariKategori, javax.swing.JLayeredPane.DEFAULT_LAYER);

        frameCariKodeNama.setClosable(true);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 24));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("PENCARIAN BERDASARKAN KODE / NAMA OBAT");

        lblDokterKode.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblDokterKode.setText("Kode Obat");

        lblDokterNama.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblDokterNama.setText("Nama Obat");

        btnCariKodeNama.setFont(new java.awt.Font("Tahoma", 0, 12));
        btnCariKodeNama.setText("Cari");
        btnCariKodeNama.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCariKodeNamaActionPerformed(evt);
            }
        });

        btnBatalKodeNama.setFont(new java.awt.Font("Tahoma", 0, 12));
        btnBatalKodeNama.setText("Batal");
        btnBatalKodeNama.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBatalKodeNamaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout frameCariKodeNamaLayout = new javax.swing.GroupLayout(frameCariKodeNama.getContentPane());
        frameCariKodeNama.getContentPane().setLayout(frameCariKodeNamaLayout);
        frameCariKodeNamaLayout.setHorizontalGroup(
            frameCariKodeNamaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameCariKodeNamaLayout.createSequentialGroup()
                .addContainerGap(66, Short.MAX_VALUE)
                .addComponent(jLabel4)
                .addGap(56, 56, 56))
            .addGroup(frameCariKodeNamaLayout.createSequentialGroup()
                .addGap(207, 207, 207)
                .addComponent(btnCariKodeNama, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(46, 46, 46)
                .addComponent(btnBatalKodeNama, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(211, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, frameCariKodeNamaLayout.createSequentialGroup()
                .addContainerGap(174, Short.MAX_VALUE)
                .addGroup(frameCariKodeNamaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblDokterNama, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDokterKode, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addGroup(frameCariKodeNamaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtKodeDokter, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNamaDokter, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(100, 100, 100))
        );
        frameCariKodeNamaLayout.setVerticalGroup(
            frameCariKodeNamaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameCariKodeNamaLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(jLabel4)
                .addGap(45, 45, 45)
                .addGroup(frameCariKodeNamaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDokterKode, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtKodeDokter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(frameCariKodeNamaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDokterNama, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNamaDokter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
                .addGroup(frameCariKodeNamaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCariKodeNama, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnBatalKodeNama, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28))
        );

        frameCariKodeNama.setBounds(100, 20, 720, 340);
        jDesktopPane1.add(frameCariKodeNama, javax.swing.JLayeredPane.DEFAULT_LAYER);

        framePilihCari.setClosable(true);

        lblPilihCari.setFont(new java.awt.Font("Tahoma", 1, 24));
        lblPilihCari.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblPilihCari.setText("PENCARIAN OBAT BERDASARKAN:");

        btnBatal.setFont(new java.awt.Font("Tahoma", 0, 14));
        btnBatal.setText("Batal");
        btnBatal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBatalActionPerformed(evt);
            }
        });

        btnKodeNama.setFont(new java.awt.Font("Tahoma", 0, 14));
        btnKodeNama.setText("Kode / Nama");
        btnKodeNama.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnKodeNamaActionPerformed(evt);
            }
        });

        btnKategori.setFont(new java.awt.Font("Tahoma", 0, 14));
        btnKategori.setText("Kategori");
        btnKategori.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnKategoriActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout framePilihCariLayout = new javax.swing.GroupLayout(framePilihCari.getContentPane());
        framePilihCari.getContentPane().setLayout(framePilihCariLayout);
        framePilihCariLayout.setHorizontalGroup(
            framePilihCariLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(framePilihCariLayout.createSequentialGroup()
                .addGap(90, 90, 90)
                .addComponent(lblPilihCari, javax.swing.GroupLayout.PREFERRED_SIZE, 516, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(98, Short.MAX_VALUE))
            .addGroup(framePilihCariLayout.createSequentialGroup()
                .addGap(135, 135, 135)
                .addComponent(btnKodeNama, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 187, Short.MAX_VALUE)
                .addComponent(btnKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(150, 150, 150))
            .addGroup(framePilihCariLayout.createSequentialGroup()
                .addGap(287, 287, 287)
                .addComponent(btnBatal, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(301, Short.MAX_VALUE))
        );
        framePilihCariLayout.setVerticalGroup(
            framePilihCariLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(framePilihCariLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(lblPilihCari)
                .addGap(47, 47, 47)
                .addGroup(framePilihCariLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnKodeNama, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnKategori, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(59, 59, 59)
                .addComponent(btnBatal, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(48, Short.MAX_VALUE))
        );

        framePilihCari.setBounds(100, 20, 720, 340);
        jDesktopPane1.add(framePilihCari, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel5.setText("DAFTAR OBAT");

        tabelObatDokter.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Kode Obat", "Nama Obat", "Kategori"
            }
        ));
        tabelObatDokter.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelObatDokterMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tabelObatDokter);

        btnDetailADMIN.setText("Detail");
        btnDetailADMIN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDetailADMINActionPerformed(evt);
            }
        });

        btnCariDokter.setText("Cari");
        btnCariDokter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCariDokterActionPerformed(evt);
            }
        });

        btnBatalDokter.setText("Batal");
        btnBatalDokter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBatalDokterActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(220, 220, 220)
                        .addComponent(btnDetailADMIN, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(88, 88, 88)
                        .addComponent(btnCariDokter, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(93, 93, 93)
                        .addComponent(btnBatalDokter, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(389, 389, 389)
                        .addComponent(jLabel5))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 901, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLabel5)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(64, 64, 64)
                        .addComponent(btnDetailADMIN, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(62, 62, 62)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnBatalDokter, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
                            .addComponent(btnCariDokter, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE))))
                .addGap(166, 166, 166))
        );

        jPanel1.setBounds(0, 0, 940, 450);
        jDesktopPane1.add(jPanel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        detail.setClosable(true);

        jLabel1.setText("Kode Obat");

        jLabel2.setText("Nama Obat");

        txtnamaobat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtnamaobatActionPerformed(evt);
            }
        });

        jLabel3.setText("Kategori");

        txtkategori.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtkategoriActionPerformed(evt);
            }
        });

        jButton1.setText("Keluar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        komposisi.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "KOMPOSISI"
            }
        ));
        jScrollPane2.setViewportView(komposisi);

        indikasi.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "INDIKASI"
            }
        ));
        jScrollPane3.setViewportView(indikasi);

        kontraindikasi.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "KONTRA INDIKASI"
            }
        ));
        jScrollPane4.setViewportView(kontraindikasi);

        perhatian.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "PERHATIAN"
            }
        ));
        jScrollPane5.setViewportView(perhatian);

        dosis.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "DOSIS"
            }
        ));
        jScrollPane6.setViewportView(dosis);

        kemasan.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "KEMASAN"
            }
        ));
        jScrollPane7.setViewportView(kemasan);

        efeksamping.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "EFEK SAMPING"
            }
        ));
        jScrollPane8.setViewportView(efeksamping);

        javax.swing.GroupLayout detailLayout = new javax.swing.GroupLayout(detail.getContentPane());
        detail.getContentPane().setLayout(detailLayout);
        detailLayout.setHorizontalGroup(
            detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, detailLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, detailLayout.createSequentialGroup()
                        .addGroup(detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel2)
                            .addComponent(jLabel1))
                        .addGap(83, 83, 83)
                        .addGroup(detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtkategori)
                            .addComponent(txtnamaobat)
                            .addComponent(txtkodeobat, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)))
                    .addComponent(jButton1)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, detailLayout.createSequentialGroup()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE)))
                .addContainerGap())
        );
        detailLayout.setVerticalGroup(
            detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, detailLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtkodeobat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtnamaobat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtkategori, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(detailLayout.createSequentialGroup()
                        .addGroup(detailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
                            .addComponent(jScrollPane8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE))
                        .addGap(60, 60, 60))
                    .addGroup(detailLayout.createSequentialGroup()
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addComponent(jButton1)
                .addGap(100, 100, 100))
        );

        detail.setBounds(0, 0, 930, 510);
        jDesktopPane1.add(detail, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 932, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnDetailADMINActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDetailADMINActionPerformed
//        // TODO add your handling code here:
        tampilKomposisiDetail();
        tampilindikasidetail();
        tampilKontraIndikasiDetail();
        tampilefekDetail();
        tampilPerhatianDetail();
        tampilDosisDetail();
        tampilKemasanDetail();
        detail.setVisible(true);
}//GEN-LAST:event_btnDetailADMINActionPerformed

    private void txtnamaobatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtnamaobatActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtnamaobatActionPerformed

    private void txtkategoriActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtkategoriActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtkategoriActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        detail.setVisible(false);
        txtkategori.setText("");
        txtkodeobat.setText("");
        txtnamaobat.setText("");
    }//GEN-LAST:event_jButton1ActionPerformed

    private void btnBatalDokterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBatalDokterActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_btnBatalDokterActionPerformed

    private void tabelObatDokterMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelObatDokterMouseClicked
        // TODO add your handling code here:
        int baris = tabelObatDokter.getSelectedRow();
        String kode = tabelObatDokter.getValueAt(baris, 0).toString();
        String nama = tabelObatDokter.getValueAt(baris, 1).toString();
        String kategori = tabelObatDokter.getValueAt(baris, 2).toString();
        txtkodeobat.setText(kode);
        txtnamaobat.setText(nama);
        txtkategori.setText(kategori);
    }//GEN-LAST:event_tabelObatDokterMouseClicked

    private void btnCariDokterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCariDokterActionPerformed
        // TODO add your handling code here:
        framePilihCari.setVisible(true);
    }//GEN-LAST:event_btnCariDokterActionPerformed

    private void btnBatalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBatalActionPerformed
        // TODO add your handling code here:
        framePilihCari.doDefaultCloseAction();
    }//GEN-LAST:event_btnBatalActionPerformed

    private void btnCariKodeNamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCariKodeNamaActionPerformed
        // TODO add your handling code here:
        String kode = txtKodeDokter.getText();
        String nama = txtNamaDokter.getText();
        if(kode.equals("") && nama.equals(nama)){
            tampilCariObatNama();
        } else if(kode.equals(kode) && nama.equals("")){
            tampilCariObatKode();
        } else if(kode.equals(kode) && nama.equals(nama)){
            tampilCariObatKodeNama();
        }
        frameCariKodeNama.setVisible(false);
        framePilihCari.setVisible(false);
        txtKodeDokter.setText("");
        txtNamaDokter.setText("");
        this.setVisible(true);
    }//GEN-LAST:event_btnCariKodeNamaActionPerformed

    private void btnCariKategoriActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCariKategoriActionPerformed
        // TODO add your handling code here:
        String nama = txtCariKategori.getText();
        if(!nama.isEmpty()){
            tampilCariKategori();
        }
        frameCariKategori.setVisible(false);
        framePilihCari.setVisible(false);
        txtKodeDokter.setText("");
        this.setVisible(true);
    }//GEN-LAST:event_btnCariKategoriActionPerformed

    private void btnKodeNamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnKodeNamaActionPerformed
        // TODO add your handling code here:
        frameCariKodeNama.setVisible(true);
    }//GEN-LAST:event_btnKodeNamaActionPerformed

    private void btnKategoriActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnKategoriActionPerformed
        // TODO add your handling code here:
        frameCariKategori.setVisible(true);
    }//GEN-LAST:event_btnKategoriActionPerformed

    private void btnBatalKategoriActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBatalKategoriActionPerformed
        // TODO add your handling code here:
        frameCariKategori.dispose();
    }//GEN-LAST:event_btnBatalKategoriActionPerformed

    private void btnBatalKodeNamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBatalKodeNamaActionPerformed
        // TODO add your handling code here:
        frameCariKodeNama.dispose();
    }//GEN-LAST:event_btnBatalKodeNamaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FrameDaftarObatDokter().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBatal;
    private javax.swing.JButton btnBatalDokter;
    private javax.swing.JButton btnBatalKategori;
    private javax.swing.JButton btnBatalKodeNama;
    private javax.swing.JButton btnCariDokter;
    private javax.swing.JButton btnCariKategori;
    private javax.swing.JButton btnCariKodeNama;
    private javax.swing.JButton btnDetailADMIN;
    private javax.swing.JButton btnKategori;
    private javax.swing.JButton btnKodeNama;
    private javax.swing.JInternalFrame detail;
    private javax.swing.JTable dosis;
    private javax.swing.JTable efeksamping;
    private javax.swing.JInternalFrame frameCariKategori;
    private javax.swing.JInternalFrame frameCariKodeNama;
    private javax.swing.JInternalFrame framePilihCari;
    private javax.swing.JTable indikasi;
    private javax.swing.JButton jButton1;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JTable kemasan;
    private javax.swing.JTable komposisi;
    private javax.swing.JTable kontraindikasi;
    private javax.swing.JLabel lblCariKategori;
    private javax.swing.JLabel lblDokterKode;
    private javax.swing.JLabel lblDokterNama;
    private javax.swing.JLabel lblJudulKategori;
    private javax.swing.JLabel lblPilihCari;
    private javax.swing.JTable perhatian;
    private javax.swing.JTable tabelObatDokter;
    private javax.swing.JTextField txtCariKategori;
    private javax.swing.JTextField txtKodeDokter;
    private javax.swing.JTextField txtNamaDokter;
    private javax.swing.JTextField txtkategori;
    private javax.swing.JTextField txtkodeobat;
    private javax.swing.JTextField txtnamaobat;
    // End of variables declaration//GEN-END:variables

    private void tampilObat() {
        try {
            List<Obat> daftarobat = AdminKontrol.getKoneksiKategori().lihatSeluruhObat();
            ObatTableModel model = new ObatTableModel(daftarobat);
            tabelObatDokter.setModel(model);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilCariObatKode() {
        String kode = txtKodeDokter.getText();

        try {
            List<Obat> daftarobat = DokterKontrol.getKoneksiKategori().cariObatKode(kode);
            ObatTableModel model = new ObatTableModel(daftarobat);
            tabelObatDokter.setModel(model);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilCariObatNama() {
        String nama = txtNamaDokter.getText();

        try {
            List<Obat> daftarobat = DokterKontrol.getKoneksiKategori().cariObatNama(nama);
            ObatTableModel model = new ObatTableModel(daftarobat);
            tabelObatDokter.setModel(model);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilCariObatKodeNama() {
        String nama = txtNamaDokter.getText();
        String kode = txtKodeDokter.getText();
        try {
            List<Obat> daftarobat = DokterKontrol.getKoneksiKategori().cariObatKodeNama(kode, nama);
            ObatTableModel model = new ObatTableModel(daftarobat);
            tabelObatDokter.setModel(model);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilCariKategori() {
        String kat = txtCariKategori.getText();

        try {
            List<Obat> daftarobat = DokterKontrol.getKoneksiKategori().cariObatKategori(kat);
            ObatTableModel model = new ObatTableModel(daftarobat);
            tabelObatDokter.setModel(model);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilKomposisiDetail() {
        String a;
        a = txtkodeobat.getText();
        try {
            List<Komposisi> daftarkomp = AdminKontrol.getKoneksiKategori().lihatKomposisiTerpilih(a);
            KomposisiTerpilihTableModel model1 = new KomposisiTerpilihTableModel(daftarkomp);
            komposisi.setModel(model1);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilindikasidetail() {
        String a;
        a = txtkodeobat.getText();

        try {
            List<Indikasi> daftarkomp = AdminKontrol.getKoneksiKategori().lihatIndikasiTerpilih(a);
            IndikasiTerpilihTableModel model1 = new IndikasiTerpilihTableModel(daftarkomp);
            indikasi.setModel(model1);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilKontraIndikasiDetail() {
        String a;
        a = txtkodeobat.getText();
        try {
            List<KontraIndikasi> daftarkomp = AdminKontrol.getKoneksiKategori().lihatKontraIndikasiTerpilih(a);
            KontraIndikasiTableModelTerpilih model1 = new KontraIndikasiTableModelTerpilih(daftarkomp);
            kontraindikasi.setModel(model1);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilPerhatianDetail() {
        String a;
        a = txtkodeobat.getText();

        try {
            List<Perhatian> daftarkomp = AdminKontrol.getKoneksiKategori().lihatPerhatianTerpilih(a);
            PerhatianTableModelTerpilih model1 = new PerhatianTableModelTerpilih(daftarkomp);
            perhatian.setModel(model1);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilefekDetail() {
        String a;
        a = txtkodeobat.getText();

        try {
            List<EfekSamping> daftarkomp = AdminKontrol.getKoneksiKategori().lihatEfekTerpilih(a);
            EfekSampingTerpilihTableModel model1 = new EfekSampingTerpilihTableModel(daftarkomp);
            efeksamping.setModel(model1);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilKemasanDetail() {
        String a;
        a = txtkodeobat.getText();

        try {
            List<Kemasan> daftarkomp = AdminKontrol.getKoneksiKategori().lihatKemasanTerpilih(a);
            KemasanTerpilihTableModel model1 = new KemasanTerpilihTableModel(daftarkomp);
            kemasan.setModel(model1);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void tampilDosisDetail() {
        String a;
        a = txtkodeobat.getText();

        try {
            List<Dosis> daftarkomp = AdminKontrol.getKoneksiKategori().lihatDosisTerpilih(a);
            DosisTerpilihTableModel model1 = new DosisTerpilihTableModel(daftarkomp);
            dosis.setModel(model1);
        } catch (SQLException ex) {
            Logger.getLogger(FrameDaftarObatDokter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
